
package ui.adapter;

import android.content.Context;
import android.net.Uri;
import android.view.View;

import com.facebook.drawee.view.SimpleDraweeView;

import net.ck.hzq.R;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

import Bean.MPOSBean;
import base.BaseViewHolder;
import base.SuperBaseAdapter;


/**
 * 排行榜适配器
 * Created by chenjian on 19/2/27.
 */
public class MPosAdapter extends SuperBaseAdapter<MPOSBean.ChildrenBean.PosModelsBean> {

    List<MPOSBean.ChildrenBean.PosModelsBean> mData = new ArrayList<>();
    Context mContext;

    DecimalFormat df = new DecimalFormat("0.00");

    public MPosAdapter(Context context, List<MPOSBean.ChildrenBean.PosModelsBean> data) {
        super(context, data);
        mContext = context;
        mData = data;
    }

    @Override
    protected void convert(BaseViewHolder holder, final MPOSBean.ChildrenBean.PosModelsBean item, final int position) {
        SimpleDraweeView imageView = holder.getView(R.id.girdviewpickupmachine_img);
        imageView.setImageURI(Uri.parse(item.getImgPath()));
        holder.setText(R.id.gridviewpickup_text1, item.getName() + "")
                .setText(R.id.gridviewpickup_text2, item.getSellName() + "")
                .setText(R.id.gridviewpickup_text3, item.getActDescription())
                .setText(R.id.gridviewpickup_text4, item.getActTimeDesc() + "")
                .setText(R.id.gridviewpickup_text6, "¥ " + item.getPrice())
                .setText(R.id.gridviewpickup_text5, item.getActTimeDesc());
        holder.getView(R.id.gridviewpickup_text7).setVisibility(View.GONE);
        holder.getView(R.id.gridviewpickup_text5).setVisibility(View.GONE);
    }


    @Override
    protected int getItemViewLayoutId(int position, MPOSBean.ChildrenBean.PosModelsBean item) {
        return R.layout.gridviewpickupmachinewuliao_item;
    }

}
